// ==UserScript==
// @name asite.2500sz
// @author wgu
// @description  asite.2500sz
// @include http://asite.2500sz.com/*
// ==/UserScript==

(function($,jQuery){
gw.import('yzm2.js',window);
var req=gw.req();

var code={
	"011110100001100001100001100001100001100001100001100001011110":'0',
	"001000111000001000001000001000001000001000001000001000111110":'1',
	"011110100001100001000001000010000100001000010000100001111111":'2',
	"011110100001100001000010001100000010000001100001100001011110":'3',
	"000100000100001100010100100100100100111111000100000100001111":'4',
	"111111100000100000101110110001000001000001100001100001011110":'5',
	"001110010001100000100000101110110001100001100001100001011110":'6',
	"111111100010100010000100000100001000001000001000001000001000":'7',
	"011110100001100001100001011110010010100001100001100001011110":'8',
	"011100100010100001100001100011011101000001000001100010011100":'9'
};

function diff(a,b){
	var re=0;
	for(var i=0,l=a.length;i<l;i++){
		if(a[i]!=b[i]){
			re++;
		}
	}
	return re;
}

$.yzm.prototype.get=function(tmp){
	if(code[tmp.tz.point]){
		return code[tmp.tz.point];
	}else{
		for(var i in code){
			if(diff(i,tmp.tz.point)<=3){
				return code[i];
			}
		}
		return 'z';
	}
}

function erro(){
	document.getElementById("dddd").src='getcode.asp?rnd='+Math.random();
}
var yz=new $.yzm($('#dddd')[0],8);
$('#dddd').bind('load',function (){
	$('#addr')[0].value='';
	try{
		var v=yz.load().cut();
		$('#addr')[0].value=v;
		req.open('POST',"http://asite.2500sz.com/11/12/sqask/tijiao.asp",false);
		req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		req.send("CodeStr="+v+"&id=4")
		document.getElementById("dddd").src='getcode.asp?rnd='+Math.random();
	}catch (e) {
		erro();
		return;
	}
});

})(___jQuery,___jQuery)